package com.qiang.test04;

public class Demo {
    public static void main(String[] args) {
        String name = Season.SPRING.name();
        System.out.println(name);
        int ordinal = Season.SUMMER.ordinal();
        System.out.println(ordinal);

        int i = Season.SUMMER.compareTo(Season.WINTER);
        System.out.println(i);

        String s = Season.SPRING.toString();
        System.out.println(s);

        System.out.println("-----------------------------");

//        static <T> T valueOf(Class<T> type,String name)
//        获取指定枚举类中的指定名称的枚举值
        Season spring = Enum.valueOf(Season.class, "SPRING");
        System.out.println(spring);
        System.out.println(Season.SPRING == spring);
        System.out.println("-----------------------------");

        Season[] values = Season.values();
        for (Season value : values) {
            System.out.println(value);
        }
    }
}
